﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NodeBasedSkillEditor.Model.Node.RT
{
    public class Node_IntegerToScalar_RT : RT_Node
    {
        public RT_SingleValuePort In_Integer;

        public RT_SingleValuePort Out_Scalar;

        public Node_IntegerToScalar_RT(Node_IntegerToScalar sourceData, RT_DAG parentDag) : base(sourceData, parentDag)
        {
            In_Integer = new RT_SingleValuePort(EPortIOType.Input, sourceData.Integer, this);

            Out_Scalar = new RT_SingleValuePort(EPortIOType.Output, sourceData.Scalar, this);
            Out_Scalar.OnGetValue = GetOutScalar;
        }

        public AValue GetOutScalar(DAG_Executor executor)
        {
            var intValue = In_Integer.GetValue(executor) as Value_Integer;
            Out_Scalar.SourceValue.SetInteger(intValue.Value);
            return Out_Scalar.SourceValue;
        }
    }
}
